import { Component, OnInit } from '@angular/core';

declare var form: any;

@Component({
    templateUrl: './cloud.column.component.html'
})
export class CloudColumnComponent implements OnInit {

    public fs: any = null;
    public dicTypeDic: any = null;
    public specialTypeDic: any = null;

    constructor() {
        // 注册表单
        this.fs = new form.FormTreeService('cloudcolumn', {
            orderObject: { order: 0 },
            keyField: 'id',
            randomFields: ['id'],
            pageSize: 1000
        });
        // 加载表单数据
        this.fs.loadData();

        // 初始化字典
        this.dicTypeDic = new form.DictionaryService('dictionary_type');
        this.specialTypeDic = new form.DictionaryService('cloud_special');
    }
    // 保存实体
    save() {
        const fo = this.fs;
        if (fo.isSaveing) {
            return false;
        }
        const row = fo.er;
        if (row.dictionaryType === '2' || row.dictionaryType === '3') {
            row.leaf = true;
        } else {
            row.leaf = false;
        }
        this.fs.save(row);
    }

    ngOnInit(): void {

    }
}
